package controleur;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.filechooser.FileNameExtensionFilter;

import vue.AffichageCreationAlbum;
/**
 * 
 * @author Plancq Charlotte, Lanvin Kévin, Darras Raphael
 *
 *
 */
public class RecuperateurImage implements ActionListener{
	private JPanel aca;

	public RecuperateurImage (JPanel aca){
		this.aca=aca;
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		JFileChooser chooser = new JFileChooser();
		FileNameExtensionFilter filter = new FileNameExtensionFilter("Images","png","jpg","jpeg");
		chooser.setFileFilter(filter);
		int returnVal = chooser.showOpenDialog(aca);
		if(returnVal == JFileChooser.APPROVE_OPTION) {
			@SuppressWarnings("unused")
			File fichier=chooser.getSelectedFile();
			((AffichageCreationAlbum) aca).setImage(chooser.getSelectedFile().getAbsolutePath());
		}
	}
}
